package com.zx.centers.dataservice.mybatis.mapper.centers;

import com.zx.centers.dataservice.mybatis.domain.centers.SysDictType;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

public interface SysDictTypeMapper {
    @Delete({
        "delete from sys_dict_type",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int deleteByPrimaryKey(Long id);

    @Insert({
        "insert into sys_dict_type (id, dict_code, ",
        "dict_name, create_time, ",
        "update_time, dict_value, ",
        "remark)",
        "values (#{id,jdbcType=BIGINT}, #{dictCode,jdbcType=VARCHAR}, ",
        "#{dictName,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, ",
        "#{updateTime,jdbcType=TIMESTAMP}, #{dictValue,jdbcType=VARCHAR}, ",
        "#{remark,jdbcType=VARCHAR})"
    })
    int insert(SysDictType record);

    @InsertProvider(type=SysDictTypeSqlProvider.class, method="insertSelective")
    int insertSelective(SysDictType record);

    @Select({
        "select",
        "id, dict_code, dict_name, create_time, update_time, dict_value, remark",
        "from sys_dict_type",
        "where id = #{id,jdbcType=BIGINT}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="dict_code", property="dictCode", jdbcType=JdbcType.VARCHAR),
        @Result(column="dict_name", property="dictName", jdbcType=JdbcType.VARCHAR),
        @Result(column="create_time", property="createTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="update_time", property="updateTime", jdbcType=JdbcType.TIMESTAMP),
        @Result(column="dict_value", property="dictValue", jdbcType=JdbcType.VARCHAR),
        @Result(column="remark", property="remark", jdbcType=JdbcType.VARCHAR)
    })
    SysDictType selectByPrimaryKey(Long id);

    @UpdateProvider(type=SysDictTypeSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(SysDictType record);

    @Update({
        "update sys_dict_type",
        "set dict_code = #{dictCode,jdbcType=VARCHAR},",
          "dict_name = #{dictName,jdbcType=VARCHAR},",
          "create_time = #{createTime,jdbcType=TIMESTAMP},",
          "update_time = #{updateTime,jdbcType=TIMESTAMP},",
          "dict_value = #{dictValue,jdbcType=VARCHAR},",
          "remark = #{remark,jdbcType=VARCHAR}",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(SysDictType record);
}